package cn.tedu.voice.system.ex.handler;

import cn.tedu.voice.system.ex.ServiceException;
import cn.tedu.voice.system.mvc.JsonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@Slf4j
@RestControllerAdvice
public class GlobalExceptionHandier {

    @ExceptionHandler
    public JsonResult<Void> handleServiceException(ServiceException e){
        log.warn("程序运行过程中出现ServiceException，将统一处理！");
        log.warn("异常信息：{}",e.getMessage());
        return JsonResult.fail(e);
    }


}
